package com.ljm.boot.rocketmq.consumer;


import com.ljm.boot.rocketmq.domain.OrderInfo;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;

/**
 * consumeMode= ConsumeMode.ORDERLY
 * ORDERLY 单线程消费；适用于顺序消费
 * CONCURRENTLY 多线程消费，并发执行
 */
@RocketMQMessageListener(consumerGroup = "",topic = "",consumeMode= ConsumeMode.ORDERLY )
public class OrderConsumer implements RocketMQListener<MessageExt> {

    public void onMessage(OrderInfo order) {
        System.out.println("收到mq信息");
    }

    @Override
    public void onMessage(MessageExt messageExt) {
        String msgId=null;
        String tags=null;
        String keys=null;
        String body=null;
        try {
            //1. 解析消息内容
            msgId = messageExt.getMsgId();
            tags= messageExt.getTags();
            keys= messageExt.getKeys();
            body= new String(messageExt.getBody(),"UTF-8");


    }catch (Exception e){
        }
    }
}
